﻿using GameServer.Model;
using Serilog;
using Summer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameServer.Battle
{
    public class Skill
    {
        public SkillDefine Define;
        public Actor Owner;
        public float Cooldown;
        private float _time;
        public SkillState State;
        public Skill(Actor owner,int skid) 
        {
            Owner=owner;
            Define = DataManager.Instance.CharacterSkillDict[skid];
        }

        public void Update()
        {
            if (Cooldown > 0) Cooldown -= Time.deltaTime;
            if (Cooldown < 0) Cooldown = 0;
            _time += Time.deltaTime;

            if(State==SkillState.Casting&& _time >= Define.IntonateTime)
            {
                State = SkillState.Active;
            }
            if(State==SkillState.Active)
            {
                Log.Information("Skill Active{0}",Define.Name);
            }
        }
    }

    public enum SkillState
    {
        None,
        Casting,
        Active
    }
}
